#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

const ll mod = 1000000007;
ll dp[10000 + 50];


void hanoi(int n, char A, char B, char C) {
    if (n == 1) {
        printf("移动圆盘:%d从盘%c到盘%c\n", n, A, C);
    } else {
        hanoi(n - 1, A, C, B);
        printf("移动圆盘:%d从盘%c到盘%c\n", n, A, C);
        hanoi(n - 1, B, A, C);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    hanoi(n, 'a', 'b', 'c');
    printf("%lld\n", (1ll << n) - 1);
    return 0;
}
